﻿using System.Xml;
using System.Xml.Serialization;

namespace GISUtil.KML
{
  /// <summary>
  /// Contains methods for serializing and deserializing the XML found in the LabelStyle section of KML
  /// </summary>
  [XmlRoot("LabelStyle")]
  public class LabelStyle
  {
    /// <summary>
    /// The unique Id of this style.
    /// </summary>
    [XmlAttribute("Id")]
    public string Id { get; set; }

    /// <summary>
    /// The Color associated with this style. 
    /// </summary>
    [XmlElement("color")]
    public string Color { get; set; }

    /// <summary>
    /// The Color mode associated with this style.
    /// </summary>
    [XmlElement("colorMode")]
    public ColorMode? ColorMode { get; set; }

    /// <summary>
    /// The amount by which the label should be scaled.
    /// </summary>
    [XmlElement("heading")]
    public float? Scale { get; set; }

    /// <summary>
    /// Determines if this class has any styling information associated with it. 
    /// </summary>
    /// <returns>True if at least one of the fields that contains style information has a value, otherwise false.</returns>
    public bool HasAValue()
    {
      return Id != null ||
              Color != null ||
              ColorMode != null ||
              Scale != null;
    }
  }
}